

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Data extends JFrame{
    public Data(String userid){
        setTitle("Data Operation");
        Container container=getContentPane();
        setLayout(new BorderLayout());


        JPanel titlePanel=new JPanel();
        JLabel title=new JLabel("Data Operation");
        title.setFont(new Font("",Font.BOLD,25));
        titlePanel.add(title);
        add(titlePanel,BorderLayout.NORTH);

        JPanel mainOp=new JPanel();


        JPanel panel1=new JPanel();
        panel1.add(new JLabel("Search as productID:"));

        JTextField productSearch=new JTextField(20);
        JButton productEnter=new JButton("Search");
        productEnter.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new Data_Device(productSearch.getText());

            }
        });

        panel1.add(productSearch);
        panel1.add(productEnter);
        mainOp.add(panel1);



        JPanel panel2=new JPanel();
        panel2.add(new JLabel("    Search as ClassID:"));

        JTextField classSearch=new JTextField(20);
        JButton classEnter=new JButton("Search");
        classEnter.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                new Data_Type(classSearch.getText());

            }
        });

        panel2.add(classSearch);
        panel2.add(classEnter);
        mainOp.add(panel2);



        JPanel panel3=new JPanel();
        panel3.add(new JLabel("    Search as familyID:"));

        JTextField familySearch=new JTextField(20);
        JButton familyEnter=new JButton("Search");
        familyEnter.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                new Device_Family(familySearch.getText());

            }
        });

        panel3.add(familySearch);
        panel3.add(familyEnter);
        mainOp.add(panel3);




        add(mainOp,BorderLayout.CENTER);




        JPanel buttons=new JPanel();

        JButton back=new JButton("Back");
        back.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                new ManagerDefaultFrame(userid);
            }
        });
        buttons.add(back);
/*
        JButton general=new JButton("General Search");
        general.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {


            }
        });
        buttons.add(general);
*/
        add(buttons,BorderLayout.SOUTH);



        setSize(500,300);
        setVisible(true);
        setResizable(false);
        setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    }
}
